<form class="layui-form seller-form" action="">
    <div class="layui-form-item">
        {if empty($user_id)}
        <div class="layui-inline">
            <label class="layui-form-label">手机号：</label>
            <!-- <div class="layui-input-inline seller-inline-3"> -->
            <div class="layui-input-inline">
                <input type="text" name="mobile" placeholder="请输入手机号" autocomplete="off" class="layui-input">
            </div>
        </div>
        {/if}
        <div class="layui-inline">
            <label class="layui-form-label">时间：</label>
            <div class="layui-input-inline">
                <input type="text" name="date" id="date" placeholder="开始时间 到 结束时间" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">类型：</label>
            <div class="layui-input-inline">
                <select name="type" id="type">
                    <option value="">请选择</option>
                    {volist name="type" id="val"}
                    <option value="{$key}">{$val}</option>
                    {/volist}
                </select>
            </div>
        </div>

        <div class="layui-inline" id="layui--group-container">
            <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*"><i
                    class="iconfont icon-chaxun"></i>筛选</button>
        </div>
    </div>

</form>
<div class="table-body">
    {if !empty($user_id)}
    <a class="layui-btn layui-btn-sm" style="margin-top: 10px;" href="{:url('manage/user/index')}">返回</a>
    {/if}
    <table id="pointLog" lay-filter="pointLog"></table>
</div>
<script>
    var table;
    layui.use(['form', 'layedit', 'laydate','table'], function(){
        layui.form.render();
        layui.laydate.render({
            elem: '#date',
            range: '到',
            format: 'yyyy-MM-dd',
            trigger: 'click' //自动弹出控件的事件，采用click弹出
        });
        table = layui.table.render({
            elem: '#pointLog',
            cellMinWidth: '80',
            page: 'true',
            limit:'20',
            url: "{:url('User/pointLog')}?_ajax=1&user_id={$user_id}&flag=true",
            id:'pointLog',
            height: 'full-120',
            response: {
                statusName: 'status',
                statusCode: 1
            },
            cols: [[
                {field:'id', width:90, title:'ID', align:'center'},
                {field:'username', width:200, title:'用户', align:'center'}, 
                {field:'type', width:120, title:'类型', align:'center'},
                {field:'num', width:110, title:'数量', align:'center'},
                {field:'balance', width:150, title:'余额', align:'center'},
                {field:'remarks', title: '备注', align:'center'},
                {field:'ctime', width:165, title:'时间', align:'center'}
            ]]
        });
        layui.form.on('submit(*)', function(data){
            layui.table.reload('pointLog', {
                where: data.field
                ,page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>